(library (commands utils)
  (export process-input-port)
  (import (except (rnrs base) error map)
          (only (guile)
                lambda* λ
                ;; control flow
                when
                unless
                ;; ports
                current-input-port
                current-output-port
                current-error-port
                with-input-from-port
                with-output-to-port
                with-error-to-port
                call-with-input-file
                eof-object?)
          (ice-9 textual-ports))


  (define process-input-port
    (λ (port proc)
      (let next-line ([line (get-line port)])
        (cond
         [(eof-object? line) '()]
         [else
          (cons (proc line)
                (next-line (get-line port)))])))))
